<?php

namespace App\Http\Controllers\Admin;

use App\Http\Repository\MessageRepository;
use App\Http\Servers\Admin\BaseServer;
use Illuminate\Http\Request;

use App\Http\Controllers\Controller;

class CommonController extends Controller
{
    public function __construct(Request $request, BaseServer $baseServer, MessageRepository $messageRepository)
    {
        \Cache::flush();

        $this->middleware('auth:admin');
        $this->middleware('operate');

        config(['set' => $baseServer->getConfig()]);
        config(['web_ico' => \App\Image::where('id', config('set.web_ico'))->value('path')]);

        view()->share([
            'frame' => $baseServer->gater(),
            'chunklist' => $baseServer->getChunk(),
            'messageNum' => $messageRepository->getMessageNum(),
        ]);
    }
}
